﻿using System.Data.Entity;

namespace WebPagePro.Models
{
    public class UserContext : DbContext
    {
            static UserContext()
            {
                Database.SetInitializer(new MyDbContextInitializer());
            }
    }

public class MyDbContextInitializer : DropCreateDatabaseIfModelChanges<UserContext>
{
    protected override void Seed( UserContext dbContext )
    {
        // seed data
        // Ath. hér er hægt að skilgreina hvaða gögn eigi að vera inni í grunninum þegar hann verður búinn til.
        // Það er engin skylda að gera neitt hér frekar en þið viljið.

        base.Seed( dbContext );
    }

        // You can add custom code to this file. Changes will not be overwritten.
        // 
        // If you want Entity Framework to drop and regenerate your database
        // automatically whenever you change your model schema, add the following
        // code to the Application_Start method in your Global.asax file.
        // Note: this will destroy and re-create your database with every model change.
        // 
        // System.Data.Entity.Database.SetInitializer(new System.Data.Entity.DropCreateDatabaseIfModelChanges<WebPagePro.Models.UserContext>());

        public DbSet<Student> Students { get; set; }
}
}
